﻿@model Tuple<string,List<deviceManage.Models.Room>>

@{
    Layout = null;
}
<div class="layui-form" lay-filter="roomForm" style="padding: 20px 30px 0 0;">
    <input type="hidden" name="checkId" value="@Model.Item1" />
    <div class="layui-form-item">
        <label class="layui-form-label">机房</label>
        <div class="layui-input-inline">
            <select name="roomId">
                @foreach (var type in Model.Item2)
               {
                <option value="@type.Id">@type.Name</option>
               }
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">环境湿度</label>
        <div class="layui-input-inline">
            <input type="text" name="Temperature" value="" lay-verify="required" placeholder="请输入湿度" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">环境温度</label>
        <div class="layui-input-inline">
            <input type="text" name="Humidity" value="" lay-verify="required" placeholder="请输入湿度" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item center">
        <input type="button" lay-submit="" lay-filter="createRoom" value="确认" class="layui-btn">
    </div>
</div>
<script>
     
            form.render("select", 'roomForm');

            //监听提交
            form.on('submit(createRoom)', function (data) {
                var field = data.field; //获取提交的字段 
                //提交 Ajax 成功后，关闭当前弹层并重载表格
                $.post("/checkLog/doAddRoom", field, function (d) {
                    layer.msg(d.msg);
                    if (d.code == 1) {
                        tableRoom.reload();
                        layer.close(currentWinIndex)
                    }
                });

            });
</script>